/*
 * @Description: 
 * @Author: mmzhang
 * @Date: 2021-12-10 16:52:09
 * @LastEditTime: 2021-12-17 17:05:48
 */
import Opt from '@/components/dt/info/Opt.js'
import ruleOpt from '@/biz/option/rule.js'

let _this = null
class ExamineOpt extends Opt {

  constructor(vm) {
    _this = vm
    super()
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [{
      title: '审核状态',
      key: 'auditResults',
      placeholder: '请选择',
      select: {
        options: [{
          key: '2',
          value: '通过',
        },
        {
          key: '3',
          value: '不通过',
        }]
      },
      change: (val) => {
        console.log(val)
        if (val.value == '3') {
          this.opts.push(this.rejectedReason)
        } else {
          this.opts.remove(this.rejectedReason)
        }
      },
      rules: [
        ruleOpt.required('审核状态不可为空', 'string')
      ]
    }]

    this.rejectedReason = [{
      title: '驳回原因',
      key: 'rejectedReason',
      placeholder: '请输入驳回原因',
      input: {
        type: 'textarea'
      },
      rules: [
        ruleOpt.required('驳回原因不可为空', 'string')
      ]
    }]
  }
}

export default ExamineOpt